<?php

class GroupsController extends AppController {
    
    public function beforeFilter() {
        parent::beforeFilter();
        
        $this->validateOrganisationAccount();
    }
    
    public function home() {
        
    }
    
    public function groups_table() {
        
        $org_account = $this->Session->read('org_account');
        
        $response = $this->Api->post('/groups/members', array(
            'organisation_id' => $org_account['Organisation']['id'],
            'group_id' => $_POST['group_id']
        ));
        
        if( $response['status'] == 'success' ) {
            $this->set('members', $response['data']);
            $this->set('group', $response['group']);
        }
    }
}